/**
 */
package OBSL.impl;

import OBSL.OBSLPackage;
import OBSL.TemporalParameter;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Temporal Parameter</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link OBSL.impl.TemporalParameterImpl#getLinksTo <em>Links To</em>}</li>
 *   <li>{@link OBSL.impl.TemporalParameterImpl#getLinkedFrom <em>Linked From</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TemporalParameterImpl extends ParameterImpl implements TemporalParameter {
	/**
	 * The cached value of the '{@link #getLinksTo() <em>Links To</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinksTo()
	 * @generated
	 * @ordered
	 */
	protected TemporalParameter linksTo;

	/**
	 * The cached value of the '{@link #getLinkedFrom() <em>Linked From</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLinkedFrom()
	 * @generated
	 * @ordered
	 */
	protected TemporalParameter linkedFrom;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TemporalParameterImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return OBSLPackage.Literals.TEMPORAL_PARAMETER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TemporalParameter getLinksTo() {
		if (linksTo != null && linksTo.eIsProxy()) {
			InternalEObject oldLinksTo = (InternalEObject)linksTo;
			linksTo = (TemporalParameter)eResolveProxy(oldLinksTo);
			if (linksTo != oldLinksTo) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, oldLinksTo, linksTo));
			}
		}
		return linksTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TemporalParameter basicGetLinksTo() {
		return linksTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetLinksTo(TemporalParameter newLinksTo, NotificationChain msgs) {
		TemporalParameter oldLinksTo = linksTo;
		linksTo = newLinksTo;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, oldLinksTo, newLinksTo);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLinksTo(TemporalParameter newLinksTo) {
		if (newLinksTo != linksTo) {
			NotificationChain msgs = null;
			if (linksTo != null)
				msgs = ((InternalEObject)linksTo).eInverseRemove(this, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, TemporalParameter.class, msgs);
			if (newLinksTo != null)
				msgs = ((InternalEObject)newLinksTo).eInverseAdd(this, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, TemporalParameter.class, msgs);
			msgs = basicSetLinksTo(newLinksTo, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, newLinksTo, newLinksTo));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TemporalParameter getLinkedFrom() {
		if (linkedFrom != null && linkedFrom.eIsProxy()) {
			InternalEObject oldLinkedFrom = (InternalEObject)linkedFrom;
			linkedFrom = (TemporalParameter)eResolveProxy(oldLinkedFrom);
			if (linkedFrom != oldLinkedFrom) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, oldLinkedFrom, linkedFrom));
			}
		}
		return linkedFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TemporalParameter basicGetLinkedFrom() {
		return linkedFrom;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetLinkedFrom(TemporalParameter newLinkedFrom, NotificationChain msgs) {
		TemporalParameter oldLinkedFrom = linkedFrom;
		linkedFrom = newLinkedFrom;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, oldLinkedFrom, newLinkedFrom);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLinkedFrom(TemporalParameter newLinkedFrom) {
		if (newLinkedFrom != linkedFrom) {
			NotificationChain msgs = null;
			if (linkedFrom != null)
				msgs = ((InternalEObject)linkedFrom).eInverseRemove(this, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, TemporalParameter.class, msgs);
			if (newLinkedFrom != null)
				msgs = ((InternalEObject)newLinkedFrom).eInverseAdd(this, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, TemporalParameter.class, msgs);
			msgs = basicSetLinkedFrom(newLinkedFrom, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, newLinkedFrom, newLinkedFrom));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				if (linksTo != null)
					msgs = ((InternalEObject)linksTo).eInverseRemove(this, OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM, TemporalParameter.class, msgs);
				return basicSetLinksTo((TemporalParameter)otherEnd, msgs);
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				if (linkedFrom != null)
					msgs = ((InternalEObject)linkedFrom).eInverseRemove(this, OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO, TemporalParameter.class, msgs);
				return basicSetLinkedFrom((TemporalParameter)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				return basicSetLinksTo(null, msgs);
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				return basicSetLinkedFrom(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				if (resolve) return getLinksTo();
				return basicGetLinksTo();
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				if (resolve) return getLinkedFrom();
				return basicGetLinkedFrom();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				setLinksTo((TemporalParameter)newValue);
				return;
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				setLinkedFrom((TemporalParameter)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				setLinksTo((TemporalParameter)null);
				return;
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				setLinkedFrom((TemporalParameter)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case OBSLPackage.TEMPORAL_PARAMETER__LINKS_TO:
				return linksTo != null;
			case OBSLPackage.TEMPORAL_PARAMETER__LINKED_FROM:
				return linkedFrom != null;
		}
		return super.eIsSet(featureID);
	}

} //TemporalParameterImpl
